﻿
Public Class CDiff_FileHash_ByHash
	'Data
	Public SourceOnly As List(Of Guid)
	Public TargetOnly As List(Of Guid)
	Public Matching As List(Of Guid)
	Public Changed As Dictionary(Of Guid, CDiff_String)

	Public Sub New()
		SourceOnly = New List(Of Guid)
		TargetOnly = New List(Of Guid)
		Matching = New List(Of Guid)
		Changed = New Dictionary(Of Guid, CDiff_String)
	End Sub

	Public Sub New(source As CFolderHash, target As CFolderHash)
		Dim d As CDiff_Guid = source.DiffOnHash(target)

		Me.SourceOnly = d.SourceOnly
		Me.TargetOnly = d.TargetOnly
		Me.Matching = d.Matching

		Me.Changed = New Dictionary(Of Guid, CDiff_String)
		For Each i As Guid In Me.Matching
			Dim src As List(Of String) = source.GetFiles(i)
			Dim tar As List(Of String) = target.GetFiles(i)
			Dim diff As CDiff_String = CDiffLogic.Diff(src, tar)
			If diff.SourceOnly.Count + diff.TargetOnly.Count > 0 Then
				Me.Changed.Add(i, diff)
			End If
		Next
	End Sub

End Class
